package com.heima.article.feign;

import com.heima.feign.article.ArticleClient;
import com.heima.article.service.ArticleService;
import com.heima.model.article.dto.ArticleDto;
import com.heima.model.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 张一恒
 * @version 1.0
 * @description: 文章 feign接口
 * @date 2023/1/13 21:26
 */
@RestController
@RequestMapping("/api/v1/article")
public class ArticleFeignClient implements ArticleClient {

    @Autowired
    private ArticleService articleService;
    /**
     * @description 保存文章数据接口
     * @param articleDto
     * @return com.heima.model.dtos.ResponseResult<java.lang.Long>
     * @author 31115
     * @date 2023/1/13 21:25
     */
    @PostMapping("/save")
    @Override
    public ResponseResult<Long> saveArticle(@RequestBody ArticleDto articleDto) {
        return articleService.saveArticle(articleDto);
    }
}
